package com.wtf.dsp.admin.controller.api;

import com.wtf.dsp.admin.core.executor.WtfDynamicDataSourceMybatisConfigExecutor;
import com.wtf.dsp.admin.core.model.api.DataChangeRequest;
import com.wtf.dsp.core.api.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * ClassName: DataChangeController
 * Description:
 * date: 2023/8/3 18:01
 *
 * @author linhuanyou
 * @version 1.0
 */
@Api(tags = "节点数据更新")
@RestController
@RequestMapping("/mc")
public class DataChangeController {

    @Autowired
    private WtfDynamicDataSourceMybatisConfigExecutor wtfDynamicDataSourceMybatisConfigExecutor;

    @ApiOperation(value = "数据更新")
    @PostMapping("/dataChange")
    public R dataChange(@RequestBody @Validated DataChangeRequest dataChangeRequest){
        wtfDynamicDataSourceMybatisConfigExecutor.dataChangeRefresh(dataChangeRequest);
        return R.ok();
    }
}
